package cn.nai.DemoRan.demo08;
public class Student1 implements Comparable<Student1>{
    int ID;
    String name;
    int age;
    public Student1(int ID, String name, int age) {
        super();
        this.ID = ID;
        this.name = name;
        this.age = age;
    }
    @Override
    public String toString() {
        return "Student:" +
                "ID=" + ID +
                ", name='" + name + '\'' +
                ", age=" + age ;
    }
    @Override
    public int compareTo(Student1 o) {
        if (this.age > o.age){
            return 1;
        }
        else{
            return -1;
        }
    }

}